package com.lehoon.tomato.controller;

import com.alibaba.fastjson.JSONObject;
import com.lehoon.tomato.model.UserBean;
import com.lehoon.tomato.service.TestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test/")
public class TestController {
    private static final Logger logger = LoggerFactory.getLogger(TestController.class);

    @Resource
    private TestService userService;

    @RequestMapping("getUser")
    public String getUser(Long userId){
        logger.debug("debug");
        logger.info("info");
        logger.warn("warn");
        logger.error("error");
        UserBean userBean = userService.getUserById(userId);
        return JSONObject.toJSONString(userBean);
    }
}
